package edu.luc.concordia; 
/** 
   COPYRIGHT (C) 2008 Team Concordia. All Rights Reserved.
   Retail CheckOut and Return System Cycle 1 Implementation
   @author Rashmi Pandey & Piyushaben Desai
   @version 1.00 OCT-06-2008
*/
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTextField;

/**
 * Copyright 2008 Project Concordia
 * <p>
 * This file is part of RetailReturnSystem.
 * <p>
 * RetailReturnSystem is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <p>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
 * <hr>
 * This class use to confirm with clerk that He wants to shut down
 *  the system.
 *  I keep all style comments only in this form to inform team that we can go for it...
 */
public class SystemShutDown extends JPanel implements ActionListener
{
	private JButton noButton;	
	private JButton yesButton;
	private JLabel messageLabel;
	private JFrame frame;
    

    public SystemShutDown ()
    {
		
	}
	
	public SystemShutDown (JFrame frame)
	{
		this.frame = frame;
		this.setLayout(new BorderLayout());
		JPanel displayPanel = new JPanel();
		displayPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
		
		//File name Label 
		messageLabel = new JLabel ("Are you sure you want to shut down system?");
		displayPanel.add(messageLabel);
		
		
		//Button Panel
		JPanel buttonPanel = new JPanel();
		buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
		//Start Button
		yesButton = new JButton("YES");
		yesButton.addActionListener(this);
		buttonPanel.add(yesButton);
				
		//Cancel Button
		noButton = new JButton ("NO");
		noButton.addActionListener(this);
		buttonPanel.add(noButton);
		this.add(displayPanel, BorderLayout.CENTER);
		this.add(buttonPanel, BorderLayout.SOUTH);		
	}
	
	public void actionPerformed(ActionEvent e)
	{
		Object source = e.getSource();
		if (source == noButton){
			this.frame.dispose();
			JFrame frame = new Display("Retail CheckOut and Return System         Version 1.0 - Team Concordia", PanelGenerator.SYSTEM_MAIN_PANEL, null);
			frame.setVisible(true);	
		}	
		else if (source == yesButton) 
		{
					    
		    System.exit(0);			
		}					
	}		
}
		
	



